CC=cc
INC=-I/usr/include/mysql
LIB=-lpthread -lmysqlclient
CFLAGS=-c -Wall $(INC)
LDFLAGS=$(LIB)
SOURCES=main.c db_mysql.c common.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=gpslogd

.PHONY: all clean

all: $(SOURCES) $(EXECUTABLE)
	
$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@

clean:
	rm -rf *.o $(EXECUTABLE)

